< previous page page_907 next page >

Page 907
The WrCreateDB Method
Next, add the wrCreateDB method from Listing A.33.
Type.gifListing A.33. Coding the WrCreateDB function.
Public Function WrCreateDB(cMDB) As String
    '
    ' write the create db line
    '
    Dim cTemp As String
    '
    SQLVBMain.lblProgress = "Creating Script Header..."
    DoEvents
    '
    cTemp = EOL
    cTemp = cTemp + "// Create new database" + EOL
    cTemp = cTemp + "dbMake " + cDBName + ";"
    cTemp = cTemp + EOL
    '
    WrCreateDB = cTemp
    '
End Function
The WrCreateTable Method
The next step is to create each table definition. This is actually a two-step process. First, you need to create the table and its fields. Then you need to create the indexes that belong to the table. The code in Listing A.34 creates the table itself and calls the function to create the field definitions.
Type.gifListing A.34. Coding the WrCreateTable function.
Public Function WrCreateTable(tblObject As TableDef) As String
    '
    ' create a write table SQL statement
    '
    Dim cTemp As String
    Dim cTable As String
    Dim objField As Field
    '
    ' ignore system tables
    cTable = tblObject.Name
    If UCase(Left(cTable, 4)) = "MSYS" Then
        WrCreateTable = ""
        Exit Function
continues

 
< previous page page_907 next page >

If you like this book, buy it!